package com.example.douyin;

import android.app.Application;
import android.util.Log;

import com.alibaba.android.arouter.launcher.ARouter;
import com.example.douyin.db.DBUtils;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.EaseIM;
import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveBaseListener;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.uuzuche.lib_zxing.activity.ZXingLibrary;

public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ARouter.openDebug();
        ARouter.openLog();
        ARouter.init(this);//注意！！！init放在后面

        ZXingLibrary.initDisplayOpinion(this);

        EMOptions options = new EMOptions();
        options.setAppKey("1104230426171869#2203im");
        // 其他 EMOptions 配置。
        EMClient.getInstance().init(this, options);

        UMConfigure.init(this,"5a12384aa40fa3551f0001d1"
                ,"umeng",UMConfigure.DEVICE_TYPE_PHONE,"");
        PlatformConfig.setQQZone("101830139","5d63ae8858f1caab67715ccd6c18d7a5");

        //EaseIM 初始化
        if(EaseIM.getInstance().init(this, options)){
            //在做打包混淆时，关闭 debug 模式，避免消耗不必要的资源
            EMClient.getInstance().setDebugMode(true);
            //EaseIM 初始化成功之后再调用注册消息监听的代码 ...
        }
        //初始化数据库
        DBUtils.getInstance().init(this);


        String licenceURL = "https://license.vod2.myqcloud.com/license/v2/1316816019_1/v_cube.license"; // 获取到的 licence url
        String licenceKey = "14c9c10e378d7088755398882da77572"; // 获取到的 licence key
        TXLiveBase.getInstance().setLicence(this, licenceURL, licenceKey);
        TXLiveBase.setListener(new TXLiveBaseListener() {
            @Override
            public void onLicenceLoaded(int result, String reason) {
                Log.i("sss", "onLicenceLoaded: result:" + result + ", reason:" + reason);
            }
        });

    }
}
